<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
 <button @click="add">+</button>
 <span>{{n}}</span>
 <button @click="minus">-</button>
</div>
<script src="js/vue.js"></script>
<script>
   var vm=new Vue({
        el:"#app",
        data:{
            n:0
        },
        methods:{
            add(){
                this.n++;
            },
            minus(){
                if(this.n>0)this.n--;
            }
        }
    });
   console.log(vm);
</script>
</body>
</html>